var a = getApp(),
  t = require("../../../../utils/wxParse.js");

Page({
  data: {
    img: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/collect1.png?sign=87faab1d6dccba04de4342c65cee1ba6&t=1572515643",
    text: "#3b4ca9;",
    color: "#3b4ca9",
    click: "click",
    like: "赞",
    click1: "click1",
    sharetext1: ""
  },
  click: function(t) {
    var e = this;
    wx.showLoading({
      title: "加载中...",
      mask: !0
    }), wx.request({
      url: a.globalData.dic + "doctor/education/educationVote/" + e.data.token + "/" + e.data.eduid,
      success: function(a) {
        console.log(a.data.code), 200 == a.data.code && (e.setData({
          text: "#ccc;",
          color: "#ccc",
          click: "",
          like: "已赞",
          praiseNum: e.data.praiseNum + 1
        }), wx.setStorageSync("praiseNum", 1)), wx.hideLoading();
      }
    });
  },
  click1: function(t) {
    var e = this;
    wx.showLoading({
      title: "加载中...",
      mask: !0
    })
    //收藏患教
    wx.hideLoading()
    wx.showToast({
      title: "收藏成功",
      icon: "success",
      duration: 2e3
    })
  },
  click2: function(t) {
    var e = this;
    wx.showLoading({
      title: "加载中...",
      mask: !0
    });
    t.currentTarget.dataset.id;
    wx.request({
      url: a.globalData.dic + "doctor/education/deleteCollect/" + e.data.eduid + "/" + e.data.token,
      success: function(a) {
        console.log(a), 200 == a.data.code && (e.setData({
          img: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/collect1.png?sign=87faab1d6dccba04de4342c65cee1ba6&t=1572515643",
          click1: "click1",
          sharetext1: "收藏"
        }), wx.hideLoading(), wx.showToast({
          title: "取消收藏",
          icon: "none",
          duration: 2e3
        }));
      }
    });
  },
  particulars: function(e) {
    var c = this,
      o = [];
    c.setData({
      title: '',
      releaseDayTime: '',
      nmType: '',
      eduType: 2,
      contentFormat: '',
      sharetext1: 100,
      pageView: 10,
      praiseNum: 12,
      like: 9,
      imgUrl: "/assets/images/yanjing.png",
      collectAuthor: '老王',
      doctorTitle: '2018-10-23',
      nmHospital: '双手赞成',
      articleNum: 2,
      viewSumAll: 3,
      praiseSumAll: 4,
      shareSumAll: 5
    })
  },
  onLoad: function(a) {
    var h_id = a.h_id
    var h_type = a.h_type
    var t = this,
      e = wx.getStorageSync("eduid") || "",
      c = wx.getStorageSync("log") || "";
    wx.setStorageSync("pageView", 1)
    t.setData({
      eduid: e,
      token: c,
      h_id: h_id,
      h_type: h_type
    }), t.particulars();
    this.getHuanjiaocount(h_id, h_type)
  },
  onShow: function() {},
  share: function(a) {
    console.log("分享"), console.log(a), wx.setStorageSync("currentSaid", this.data.arr),
      wx.navigateTo({
        url: "/hyb_yl/backstageLife/pages/publishSaid/publishSaid?fromType=2&patientType=3"
      });
  },
  videoError: function() {
    wx.showToast({
      title: "播放失败，请稍后重试",
      icon: "none",
      duration: 2e3
    });
  },
  //查询患教内容
  getHuanjiaocount: function(h_id, h_type) {
    var that = this
    var h_type = that.data.h_type
    a.util.request({
      'url': 'entry/wxapp/Huanjiao.detail',
      data: {
        h_id: h_id,
        h_type: h_type
      },
      success: function(res) {
        console.log(res)
        that.setData({
          detail: res.data,
          nodes: res.data.h_text,
        })
      }
    })
  },
  taptxt(e) {
    console.log(e)
  }
});